package com.linsir.lin.service.impl;

import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linsir.lin.dto.GridDTO;
import com.linsir.lin.mapper.PermissionMapper;
import com.linsir.lin.pojo.Organization;
import com.linsir.lin.pojo.Permission;
import com.linsir.lin.pojo.RolePermisson;
import com.linsir.lin.service.PermissionService;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @ProjectName:linsir-lin
 * @Package:com.linsir.lin.service
 * @Title: PermissionServiceImpl
 * @Description: TODO
 * @Create:2021/6/10 10:22 by @author:Linsir
 * @Update:2021/6/10 10:22 by @author:Linsir
 * @UpdateRemark: 初始创建
 * @Version 1.0.0
 */
@Service
public class PermissionServiceImpl extends ServiceImpl<PermissionMapper, Permission> implements IService<Permission>, PermissionService {

    /**
     * 根据 rolePermisson 查找权限
     *
     * @param rolePermisson
     * @return
     */
    @Override
    public Permission permissionByRolePermission(RolePermisson rolePermisson) {
        return getById(rolePermisson.getId());
    }

    @Override
    public GridDTO<Permission> grid() {
        List<Permission> list = list();
        Integer size = list.size();
        return new GridDTO<Permission>("0","成功",size.longValue(),list);
    }
}
